import { defineStore } from 'pinia';
import { Graph, Node } from '@antv/x6';

 const useDrawingBoard = defineStore('drawingBoard', () => {
	const graph = ref<Graph>() // 全局画布对象
	const nodeSelectedList = ref<Node[]>([])

	// 存储编辑画布对象
	function setGraph(_graph: Graph) {
		graph.value = _graph
	}

	// 动态缓存框选和取消框选的节点数据
	function setNodeSelectedList(list: []) {
		nodeSelectedList.value = list
	}

	
	return {
		graph,
		setGraph,
		nodeSelectedList,
		setNodeSelectedList
	};
});

export default useDrawingBoard